using System.Collections.Generic;
using Dou.UI;
using UnityEngine;

namespace Simple
{
    public class Test_TestSprite : MonoBehaviour
    {
        public DImage img;
        public DButton btn;
        
        public DRawImage img2;
        public DButton btn2;
        
        private List<string> _names = new List<string>
        {
            "ad_sj_qiu_0000_ad_sj_qiu",
            "ad_sj_qiu_0001_ad_sj_chun",
            "ad_sj_qiu_0002_ad_sj_xia",
        };
        private int _index = 0;
        
        private List<string> _names2 = new List<string>
        {
            "sp_ty_icon_skill_linshi_1",
            "sp_ty_icon_skill_linshi_2",
            "sp_ty_icon_skill_linshi_3",
        };
        private int _index2 = 0;
        
        private void Awake()
        {
            btn.onClick.AddListener(OnClick);
            btn2.onClick.AddListener(OnClick2);
        }

        private void OnClick()
        {
            img.spriteName = _names[_index];
            _index++;
            _index %= _names.Count;
        }

        private void OnClick2()
        {
            img2.textureName = _names2[_index2];
            _index2++;
            _index2 %= _names2.Count;
        }
    }
}
